home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 2
/
SPACE - Library 2 - Volume 1.iso
/
music
/
13
/
utility
/
prnsrc.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1986-05-12
|
9KB
|
218 lines
PROGRAM Print_Source;
{ This program prints the Pascal source code from the Personal Pascal }
{ Manager instead of going back to the Desk Top }
{ Written by Dan McKee, PPN 75766,1515 }
CONST
three = 3;
{$I GEMCONST.PAS}
TYPE
{$I GEMTYPE.PAS}
VAR
Path, Name : Path_Name;
msg : Message_Buffer;
menu : Menu_Ptr;
Author_Box,Print_Box,Help_Box : Dialog_Ptr;
dummy,file_title,open_item,print_item,help_title,Author_Item,ok_button,
help_item, quit_item,sf,show_it,pushed,h_i,get_file,cancel_button
: integer;
{$I GEMSUBS.PAS}
{ Dialog box for printing a file or cancel printing }
PROCEDURE Print_Info;
BEGIN
sf := System_Font;
Print_Box := New_Dialog(15,0,0,40,9);
Print_Item := Add_DItem(Print_Box,G_Text,None,2,1,36,1,0,$1180);
Set_DText(Print_Box,Print_Item,'Printing....',sf,TE_Center);
Print_Item := Add_DItem(Print_Box,G_Text,None,2,3,36,1,0,$1180);
SET_DText(Print_Box,Print_Item,Name,sf,TE_Center);
ok_button := Add_DItem(Print_Box,G_Button,Selectable|Exit_Btn|Default,
5,5,8,2,2,$1180);
Set_DText(Print_Box,ok_button,'OK',sf,TE_Center);
cancel_button := Add_DItem(Print_Box,G_Button,Selectable|Exit_Btn,
27,5,8,2,2,$1180);
Set_DText(Print_Box,cancel_button,'Cancel',sf,TE_Center);
Center_Dialog(Print_Box);
Show_It := Do_Dialog(Print_Box,0);
END; {Print_Info}
{ to print or not to print! }
PROCEDURE Print_It;
BEGIN
{ get the dialog box }
Print_Info;
{ check to see if the ok_button was selected }
IF Obj_State(Print_Box,ok_button) <> 0 THEN
BEGIN
{ set the default input from the keyboard to the disk }
reset( INPUT, Name );
{ set the default output from the screen to the printer }
REWRITE(OUTPUT,'PRN:');
{ loop for print the file until the end-of-file character }
WHILE NOT EOF DO
BEGIN
readln(Name);
WRITELN(NAME);
END;
End_Dialog(Print_Box);
END;
{ check to see if the cancel_button was selected }
IF Obj_state(Print_Box,cancel_button) <> 0 THEN
End_Dialog(Print_Box);
END; { Print_It }
{ this module set the path directory with the extender of '.PAS' }
PROCEDURE Draw_It;
BEGIN
{ set a default path }
Path := 'A:\*.PAS';
{ Draw predefined dialog box for listing source files }
IF Get_In_File(Path,Name) THEN
{ file name select, let's go print it! }
Print_It
{ cancel button pressed, erase dialog box }
ELSE;
END; { Draw_It }
{ dialog box for displaying the programmer and giving credits }
PROCEDURE Author_Info;
BEGIN
sf := System_Font;
Author_Box := New_Dialog(15,0,0,40,18);
Author_Item := Add_DItem(Author_Box,G_Text,None,2,1,36,1,0,$1180);
Set_DText(Author_Box,Author_Item,'Print Source',sf,TE_Center);
Author_item := Add_DItem(Author_Box,G_Text,None,2,2,36,1,0,$1180);
Set_DText(Author_Box,Author_Item,'By',sf,TE_Center);
Author_item := Add_DItem(Author_Box,G_Text,None,2,3,36,1,0,$1180);
Set_DText(Author_Box,Author_Item,'Daniel H. McKee',sf,TE_Center);
Author_item := Add_DItem(Author_Box,G_Text,None,2,5,36,1,0,$1180);
Set_DText(Author_Box,Author_Item,'Compuserve - PPN 75766,1515',
sf,TE_Center);
Author_item := Add_DItem(Author_Box,G_Text,None,2,6,36,1,0,$1180);
Set_DText(Author_Box,Author_Item,'Delphi - elmac',sf,TE_Center);
Author_item := Add_DItem(Author_Box,G_Text,None,2,8,36,1,0,$1180);
Set_DText(Author_Box,Author_Item,'Using',sf,TE_Center);
Author_item := Add_DItem(Author_Box,G_Text,None,2,10,36,1,0,$1180);
Set_DText(Author_Box,Author_Item,'Personal Pascal',sf,TE_Center);
Author_item := Add_DItem(Author_Box,G_Text,None,2,11,36,1,0,$1180);
Set_DText(Author_Box,Author_Item,'Copyright (c) 1986 OSS & CCD',
sf,TE_Center);
ok_button := Add_DItem(Author_Box,G_Button,Selectable|Exit_Btn|Default,
15,15,8,2,2,$1180);
Set_DText(Author_Box,ok_button,'OK',sf,TE_Center);
Center_Dialog(Author_Box);
Show_It := Do_Dialog(Author_Box,0);
End_Dialog(Author_Box);
END;{Author_Info}
{ dialog box for program instructions }
PROCEDURE Do_Help;
BEGIN
sf := System_Font;
Help_Box := New_Dialog(15,0,0,72,14);
h_i := Add_DItem(Help_Box,G_Text,None,2,2,68,1,0,$1180);
Set_DText(Help_Box,h_i,
' This program is design to print the scorce code from Personal',
sf,TE_Left);
h_i := Add_DItem(Help_Box,G_Text,None,2,3,68,1,0,$1180);
Set_DText(Help_Box,h_i,
' Pascal Manager, but can be run from the Gem Desk Top if desired. ',
sf,TE_Left);
h_i := Add_DItem(Help_Box,G_Text,None,2,4,68,1,0,$1180);
Set_DText(Help_Box,h_i,
' To print out your desired code, move the mouse to the menu bar',
sf,TE_Left);
h_i := Add_DItem(Help_Box,G_Text,None,2,5,68,1,0,$1180);
Set_DText(Help_Box,h_i,
' "File" and click on the "Open File" option. The program is self-',
sf,TE_Left);
h_i := Add_DItem(Help_Box,G_Text,None,2,6,68,1,0,$1180);
Set_DText(Help_Box,h_i,
' explanatory from this point. If you have a second disk or ram disk,',
sf,TE_Left);
h_i := Add_DItem(Help_Box,G_Text,None,2,7,68,1,0,$1180);
Set_DText(Help_Box,h_i,
' you can change the default drive by pointing the mouse to the ',
sf,TE_Left);
h_i := Add_DItem(Help_Box,G_Text,None,2,8,68,1,0,$1180);
Set_DText(Help_Box,h_i,
' Directory, click the mouse, backspace, type in desired path, and',
sf,TE_Left);
h_i := Add_DItem(Help_Box,G_Text,None,2,9,68,1,0,$1180);
Set_DText(Help_Box,h_i,
' then move the mouse to the filenames, then click the mouse. Enjoy!',
sf,TE_Left);
ok_button := Add_DItem(Help_Box,G_Button,Selectable|Exit_Btn|Default,
30,11,8,2,2,$1180);
Set_DText(Help_Box,ok_button,'OK',sf,TE_Center);
Center_Dialog(Help_Box);
show_it := Do_Dialog(Help_Box,0);
End_Dialog(Help_Box);
END; {Do_Help}
{ this module checks the menu bar for the option selected }
PROCEDURE Do_menu(title,item : integer);
BEGIN
BEGIN
IF title = three THEN
Author_Info
ELSE IF item = open_item THEN
Draw_it
ELSE IF item = help_item THEN
Do_Help
ELSE IF item = quit_item THEN
END;
Menu_Normal(menu,title);
END; { Do_Menu }
{ loop for getting a message }
PROCEDURE Event_Loop;
VAR
which : integer;
msg : Message_Buffer;
BEGIN
REPEAT
which := Get_Event(E_Message,0,0,0,0,false,0,0,0,0,false,
0,0,0,0,msg,dummy,dummy,dummy,dummy,
dummy,dummy);
Do_Menu( Msg[3], Msg[4]);
UNTIL msg[4] = quit_item;
END; { Event_Loop }
BEGIN { Main Program }
IF Init_Gem >= 0 THEN
BEGIN
menu := New_Menu( 6, ' file printer ' );
file_title := Add_MTitle( menu, ' File ' );
Help_title := Add_MTitle( menu, ' Help ' );
open_item := Add_MItem ( menu, file_title, ' Open File ' );
help_item := Add_MItem ( menu, help_title, ' Info ');
quit_item := Add_MItem ( menu, file_title, ' Quit ' );
Draw_Menu( menu );
Event_Loop;
Erase_Menu ( menu);
Exit_Gem;
END
END. { Main }
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
ə